let mongoose = require('./model');
// 用户表
let Hospital_userSchema = new mongoose.Schema({
    name:String,
    phone:String,
    identityCard:String,
    password:String,
    code:String,
    img:String,
})
let Hospital_userModel = mongoose.model('Hospital_user',Hospital_userSchema);
// 流程结构
let OASchema = new mongoose.Schema({
    name:String,
    lev:Number,
    url:String,
    Iid:mongoose.Schema.Types.ObjectId,
})
let OAModel = mongoose.model('OA',OASchema);

// 消息表
let MessageSchema=new mongoose.Schema({
    sender:String,//发送者
    receiver:String,//接收者
    content:String,//消息内容
    MsgType:{
        type:Number,
        default:0
    },//0文本 1图片 2语音 3视频 4文件
    time:{
        type:Date,
        default:Date.now()
    },//发送时间
})
let MessageModel=mongoose.model('Message',MessageSchema);

// 用户表
let userSchema=new mongoose.Schema({
    image:String,//头像
    name:String,
    
})
let UserModel=mongoose.model('User',userSchema);
// 医生表
let doctorSchema=new mongoose.Schema({
    image:String,//头像
    name:String,//姓名
    department:String,//科室
    adder:String,//地址
    eValue:Number,//好评率
    startTime:{
        type:Number,
        default:9
    },       // 上班 时间
    endTime:{
        type:Number,
        default:17
    },       // 下班 时间
})
let DoctorModel=mongoose.model('Doctor',doctorSchema);
// 问诊表
let inquerySchema=new mongoose.Schema({
    doctor:{
        type:mongoose.Schema.Types.ObjectId,
        ref:'Doctor'
    },
    user:{
        type:mongoose.Schema.Types.ObjectId,
        ref:'User'
    },
    descript:String,//病情描述
    time:{
        type:Date,
        default:Date.now()
    },//问诊时间
    state:{
        type:Number,
        default:0
    },//问诊状态
    price:Number,//问诊费用
    imgList:[String],//图片
    inqueryType:Number,//问诊类型 0图文 1电话 2视频
})
let InqueryModel=mongoose.model('Inquery',inquerySchema);

// 就诊人表
let PermanSchema = new mongoose.Schema({
    name:String,    //性名
    sex:Number,     //性别 0 女 1男
    age:Number,     //年龄
    userId:mongoose.Schema.Types.ObjectId,  //用户id
})
let PermanModel = mongoose.model('Perman',PermanSchema);

module.exports = {
    Hospital_userModel,
    OAModel,
    MessageModel,
    UserModel,
    DoctorModel,
    InqueryModel,
    PermanModel
};